package com.happyfamily.springboot.crowdsourcingplatform.service.pan.impl;

import com.happyfamily.springboot.crowdsourcingplatform.base.result.Results;
import com.happyfamily.springboot.crowdsourcingplatform.dao.pan.SuccessCaseDao;
import com.happyfamily.springboot.crowdsourcingplatform.model.Orders;
import com.happyfamily.springboot.crowdsourcingplatform.service.pan.SuccessCaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Administrator
 * @create 2020/02/29 12:14
 */
@Service
public class SuccessCaseServiceImpl implements SuccessCaseService
{
	@Autowired
	private SuccessCaseDao successCaseDao;


	@Override
	public Results<Orders> getAllOrdesByPage(Integer offset, Integer limit)
	{

		return Results.success(successCaseDao.countAllNeeOrders().intValue(), successCaseDao.getAllOrdersByPage(offset, limit));

	}

	@Override
	public int updateSuccessCase(Integer oid, Integer successcase)
	{
		//判断是否为成功案例 1否 2是
		if (successcase == 1){

		return 	successCaseDao.updateTahil(oid,2);

		}else{
			return successCaseDao.updateTahil(oid,1);
		}


	}

	@Override
	public List<Orders> getAllFindOrders()
	{
		return successCaseDao.getFindOrdser();
	}
}
